﻿#ifndef PERSONBUILDER_H
#define PERSONBUILDER_H

#include <QPainter>
#include <QPen>

class PersonBuilder
{
public:
    PersonBuilder(QPainter* pt, int a, int b);
    virtual ~PersonBuilder() {}

    virtual void buildHead() = 0;
    virtual void buildBody() = 0;
    virtual void buildArmLeft() = 0;
    virtual void buildArmRight() = 0;
    virtual void buildLegLeft() = 0;
    virtual void buildLegRight() = 0;

protected:
    QPainter* painter;
    int w;
    int h;
};

class PersonThinBuilder : public PersonBuilder
{
public:
    using PersonBuilder::PersonBuilder;

    virtual void buildHead() override;
    virtual void buildBody() override;
    virtual void buildArmLeft() override;
    virtual void buildArmRight() override;
    virtual void buildLegLeft() override;
    virtual void buildLegRight() override;
};

class PersonDirector
{
public:
    PersonDirector(PersonBuilder* p):pb(p){}

    void create()
    {
        pb->buildHead();
        pb->buildBody();
        pb->buildArmLeft();
        pb->buildArmRight();
        pb->buildLegLeft();
        pb->buildLegRight();
    }

private:
    PersonBuilder* pb;
};

#endif // PERSONBUILDER_H
